import { Entity, Column, PrimaryColumn , ManyToOne , OneToMany, OneToOne , JoinColumn } from 'typeorm';
import { Leagues } from './leagues';
import { Players } from './players';
import { NBAData } from './nba_data';
import { TeamRankData } from './team_rank_data';

@Entity()
class Teams {

    @PrimaryColumn({
        type: "varchar",
        length: 12,
        comment: "球队id"
    })
    id: string;

    // /media/img/teams/logos/${abbr}_logo.svg
    @Column({
        type: "varchar",
        length: 255,
        comment: "球员头像地址"
    })
    avatar?: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "球队简称"
    })
    abbr: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "所在城市"
    })
    city: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "所在城市 英文"
    })
    cityEn: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "球队code"
    })
    code: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "所属联盟"
    })
    conference: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "显示简称"
    })
    displayAbbr: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "显示所属联盟"
    })
    displayConference: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "所属分区"
    })
    division: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "是否全明星球队"
    })
    isAllStarTeam: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "是否联盟球队"
    })
    isLeagueTeam: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "球队名"
    })
    name: string;

    @Column({
        type: "varchar",
        length: 255,
        comment: "球队名 英文"
    })
    nameEn: string;

    // @OneToOne(type => Leagues)
    // @JoinColumn()
    // league: Leagues;

    @ManyToOne(type => Leagues)
    league: Leagues;

    // @OneToMany(type => Players, players => players.teams)
    // players?: Players;

    // @OneToMany(type => TeamRankData,teamRankData => teamRankData.teams)
    // teamRankData?: TeamRankData;

    // @OneToMany(type => NBAData,nbaData => nbaData.teams)
    // nbaData?: NBAData;

}

export { Teams };